<p id="notice"><%= notice %></p>

<table border = "1">
	<tr>
		<td rowspan="2">
			<h4>Drug's Detail</h4>
			<p>
			  <strong>Code:</strong><%= @drug.code %></br>
			  <strong>Name:</strong><%= @drug.name %></br>
			  <strong>Price per item:</strong><%= @drug.price_per_item %></br>
			  <strong>Description:</strong><%= @drug.description %></br>
			  <%= link_to 'Edit', edit_drug_path(@drug) %> | 
			  <%= link_to 'Destroy', Drug, method: :delete, data: { confirm: 'Are you sure?' } %>
			</p>
		</td>
		<td>
			<h4>Manufacturer's Detail</h4>
			<%= render @drug.manufacturers %>
			<%= link_to 'Add New Manufacturer', new_drug_manufacturer_path(:drug_id => params[:id]) %> 
		</td>
	</tr>	
	<tr>
		<td>
			<h4>Supplier's Detail</h4>
			<%= render @drug.suppliers %>
			<%= link_to 'Add New Supplier', new_drug_supplier_path(:drug_id => params[:id]) %>
		</td>
	</tr>
	</tr>
	<tr>
		<td>
			<h4>Stock's Detail</h4>
			<table>
				<thead>
				<tr>
				  <th>Stock ID</th>
				  <th>Iventory In</th>
				  <th>quantities</th>
				  <th colspan="2"></th>
				</tr>
				</thead>
				
				<tbody>
					<%= render @drug.stocks %>
				</tbody>
			</table>
			
			</br><b>Total Stocks: <%= @total_stocks[0]["sum_id"] %> </b>
		</td>
		<td>
			<h4>Prescription's List</h4>
			<table>
				<thead>
				<tr>
				  <th>Prescription ID</th>
				  <th>Appointment By</th>
				  <th>Dosage</th>
				  <th>quantities</th>
				  <th>Note</th>
				  <th colspan="2"></th>
				</tr>
				</thead>
				
				<tbody>
					<%= render @drug.prescriptions %>
				</tbody>
			</table>
			</br><b>Total Stocks: <%= @total_prescriptions[0]["sum_id"] %> </b>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<h4>Stock's Log</h4>
			<table>
				<thead>
				<tr>
				  <th>Inventory At</th>
				  <th>Quantities</th>
				  <th>Transaction</th>
				  <th>Date</th>
				  <th></th>
				</tr>
				</thead>
				
				<tbody>
					<%= render @drug.stock_loggings %>
				</tbody>
			</table>
			<%= link_to 'Add New Transaction', new_drug_stock_logging_path(:drug_id => params[:id]) %>
			</br><b>Total Stocks: <%= @total_transactions[0]["sum_id"] %></b>
		</td>
	</tr>
</table>

